package com.gitee.cirnochat.common.exception;

import com.gitee.cirnochat.common.model.enums.ErrorCode;
import lombok.Getter;

/**
 * 业务异常类
 */
@Getter
public class MessageBusinessException extends RuntimeException {
    private final int code;
    private final Long messageId;

    public MessageBusinessException(int code, Long messageId, String message) {
        super(message);
        this.code = code;
        this.messageId = messageId;
    }

    public MessageBusinessException(int code,Long messageId, Exception e) {
        super(e.getMessage());
        this.code = code;
        this.messageId = messageId;
    }

    public MessageBusinessException(ErrorCode code, Long messageId, String message) {
        super(message);
        this.code = code.getValue();
        this.messageId = messageId;
    }

    public MessageBusinessException(ErrorCode code,Long messageId, Exception e) {
        super(e.getMessage());
        this.code = code.getValue();
        this.messageId = messageId;
    }

    public MessageBusinessException(Long messageId, ErrorCode code) {
        super(code.getMessage());
        this.code = code.getValue();
        this.messageId = messageId;
    }
}
